home *** CD-ROM | disk | FTP | other *** search
- /*------------------------------------------------------------------------
- * $Id: unique.c,v 1.1 1992/10/07 15:55:18 carlson Exp $
- *
- * This program takes all the arguments from the command line and removes
- * duplicates. It writes to stdout the resulting list.
- *
- * Revision History:
- * $Log: unique.c,v $
- * Revision 1.1 1992/10/07 15:55:18 carlson
- * Initial revision
- *
- *------------------------------------------------------------------------*/
-
- #include <stdio.h>
- #include <errno.h>
- #include <string.h>
-
- main (int argc, char *argv[])
- {
- char **arg0, **argN;
-
- for (arg0 = argv + 1; *arg0; arg0++) {
- if (**arg0 == 0xFF)
- continue;
- for (argN = arg0 + 1; *argN; argN++) {
- if (**argN == 0xFF)
- continue;
- if (strcmp (*arg0, *argN) == 0) {
- **argN = 0xFF;
- continue;
- }
- }
-
- if (*argN == NULL)
- printf ("%s ", *arg0);
- }
-
- printf ("\n");
- }
-